package IC.Parser;

public class Token extends java_cup.runtime.Symbol 
{	
	private int _line, _column;
	private String _match;
	
	/**
	 * 
	 * @param line - assuming that the first line of a file is '1' and not '0'
	 */
    public Token(int id, int line, int column, String match, java.lang.Object inpValue) 
    {
        super(id, null);
        value = inpValue;
        _line = left = line + 1;
        _column = right = column;
        _match = match;
    }
    
    public Token(int id, int line, int column, String match) { this(id, line, column, match, null); }
    
    public java.lang.Object GetValue() { return value; }
    public int GetId() { return sym; }
    public int GetLine() { return _line; }
    public int GetColumn() { return _column; }
    public String GetMatch() { return new String(_match); }
    	
    
    public String ToString() throws java.lang.Exception
    {
    	switch(sym)
    	{
			  case 1: return "ASSIGN";
			  case 2: return "BOOLEAN";
			  case 3: return "BREAK";
			  case 4: return "CLASS";
			  case 5: return "CLASS_ID";
			  case 6: return "COMMA";
			  case 7: return "CONTINUE";
			  case 8: return "DIVIDE";
			  case 9: return "DOT";
			  case 10: return "EQUAL";
			  case 11: return "EXTENDS";
			  case 12: return "ELSE";
			  case 13: return "FALSE";
			  case 14: return "GT";
			  case 15: return "GTE";
			  case 16: return "ID";
			  case 17: return "IF";
			  case 18: return "INT";
			  case 19: return "INTEGER";
			  case 20: return "LAND";
			  case 21: return "LB";
			  case 22: return "LP";
			  case 23: return "LCBR";
			  case 24: return "LENGTH";
			  case 25: return "NEW";
			  case 26: return "LNEG";
			  case 27: return "LOR";
			  case 28: return "LT";
			  case 29: return "LTE";
			  case 30: return "MINUS";
			  case 31: return "MOD";
			  case 32: return "MULTIPLY";
			  case 33: return "NEQUAL";
			  case 34: return "NULL";
			  case 35: return "PLUS";
			  case 36: return "RB";
			  case 37: return "RCBR";
			  case 38: return "RETURN";
			  case 39: return "RP";
			  case 40: return "SEMI";
			  case 41: return "STATIC";
			  case 42: return "STRING";
			  case 43: return "QUOTE";
			  case 44: return "THIS";
			  case 45: return "TRUE";
			  case 46: return "VOID";
			  case 47: return "WHILE";
			  case 48: return "EOF";
			  default: throw new java.lang.Exception("Unkown id, can't convert token to string.");
    	}
    }
    
}